Page({
  data: {
    inputContent:'',
    loadingOperation:{plain_flag:true,type_text:"warn",show_text:"停止"},
    currentChecked:['CHN'], //存放复选框中的被选中元素的value值
    currentRadioChecked:'CHN',
    currentSwitchChekced:false,
    items: [
      {value: 'USA', name: '美国'},
      {value: 'CHN', name: '中国', checked: 'true'},
      {value: 'BRA', name: '巴西'},
      {value: 'JPN', name: '日本'},
      {value: 'ENG', name: '英国'},
      {value: 'TUR', name: '法国'},
    ]
  },
  checkboxOperation:function(event){
    //由于是复选，所以event。detail.value本身就是数组，其中存放的是被选中的元素对应的value值
    this.setData({currentChecked:event.detail.value});
    console.log(this.data.currentChecked)
  },
  sumbitStop:function(event){
    let tempLoadingOperation=this.data.loadingOperation;
    tempLoadingOperation.plain_flag=!tempLoadingOperation.plain_flag;
    if(this.data.loadingOperation.type_text=="warn"){
      tempLoadingOperation.type_text='primary';
    }else{
      tempLoadingOperation.type_text='warn';
    }
    if(this.data.loadingOperation.show_text=="停止"){
      tempLoadingOperation.show_text='开始'
    }else{
      tempLoadingOperation.show_text='停止'
    }
    this.setData({loadingOperation:tempLoadingOperation});  //最后统一提交
  },
  textInput(event){
    console.log(event);
    this.setData({inputContent:event.detail.value})
  },
  focusInput(){
    console.log("文本框获得了焦点");
  },
  blurInput(){
    console.log("丢失焦点，开始校验...");
  },
  confirmInput(){
    console.log("点击了软件键盘上的完成按钮")
  },
  radioOperation:function(event){
    this.setData({currentRadioChecked:event.detail.value});
    console.log(this.data.currentRadioChecked);
  },
  switchOperation:function(event){
    this.setData({currentSwitchChekced:event.detail.value});
  },
  selectorOperation:function(event){
    console.log("选择了"+this.data.array[event.detail.value]);
    this.setData({selectorIndex:event.detail.value})
  }
})